package cn.fl.customer.service.impl;

import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cmm.mid.core.framework.page.Pager;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.fl.customer.service.ICstAssInfoService;
import cn.fl.customer.transform.CstAssInfoVOTransform;
import cn.fl.customer.vo.CstAssInfoVO;
import fl.customer.facade.customer.api.ICustomerApiService;
import fl.customer.facade.customer.dto.CstAssInfoDTO;

@Service
public class CstAssInfoServiceImpl implements ICstAssInfoService {

	/**
	 * 日志
	 */
	@SuppressWarnings("unused")
	private static final Logger logger = LoggerFactory.getLogger(CstAssInfoServiceImpl.class);
	
	/**
	 * 客户API服务
	 */
	@Autowired
	private ICustomerApiService customerApiService;

	@Override
	public CstAssInfoVO selectById(Long id) {
		if(StringUtils.isEmpty(id))return null;
		CstAssInfoDTO dto = this.customerApiService.selectCstAssInfoDTOById(id);
		return CstAssInfoVOTransform.toVO(dto);
	}

	@Override
	public Long add(CstAssInfoVO entity) {
		if(null == entity)return null;
		return this.customerApiService.addCstAssInforDTO(CstAssInfoVOTransform.toDTO(entity));
	}

	@Override
	public boolean removeByIds(List<Long> ids) {
		if(CollectionUtils.isEmpty(ids))return false;
		return this.customerApiService.removeCstAssInforByIds(ids);
	}

	@Override
	public boolean modify(CstAssInfoVO entity) {
		if(null == entity)return false;
		return this.customerApiService.modifyCstAssInforDTO(CstAssInfoVOTransform.toDTO(entity));
	}

	@Override
	public Pager searchListPage(Pager page) {
		if(null == page)page = new Pager();
		return this.customerApiService.searchCstAssInfoListPage(page);
	}
}
